package com.snake.repositories;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.snake.mapper.ActivityWinRecordMapper;
import com.snake.models.ActivityWinRecord;
import com.snake.util.DateUtil;


@Service
public class ActivityWinRecordServiceImpl implements ActivityWinRecordService {
	@Autowired
	private ActivityWinRecordMapper activityWinRecordMapper;
	@Override
	public ActivityWinRecord add(ActivityWinRecord t) {
		// TODO Auto-generated method stub
		String formatDate = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
		t.setUpdateTime(formatDate);
		t.setInsertTime(formatDate);
		ActivityWinRecord add = activityWinRecordMapper.add(t);
		return add;
	}

	@Override
	public ActivityWinRecord delete(ActivityWinRecord t) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ActivityWinRecord update(ActivityWinRecord t) {
		// TODO Auto-generated method stub
		String formatDate = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
		t.setUpdateTime(formatDate);
		ActivityWinRecord update = activityWinRecordMapper.update(t);
		return update;
	}

	@Override
	public ActivityWinRecord getById(int id) {
		// TODO Auto-generated method stub
		Map<String, Object> params=new HashMap<String, Object>();
		params.put("winRecordId", id);
		activityWinRecordMapper.getById(params);
		return null;
	}

	@Override
	public List<ActivityWinRecord> getByList(Map<String, Object> params) {
		// TODO Auto-generated method stub
		List<ActivityWinRecord> byList = activityWinRecordMapper.getByList(params);
		return byList;
	}
}
